﻿<UserControl x:Class="Adastra.RichEditorLibrary.RichTextEditor"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:custom="clr-namespace:Adastra.RichEditorLibrary"
    xmlns:controls="clr-namespace:Microsoft.WPFControlsLibrary;assembly=WPFControlsLibrary"
    xmlns:r="clr-namespace:Microsoft.Windows.Controls.Ribbon;assembly=RibbonControlsLibrary"                   
    xmlns:local="clr-namespace:Adastra.RichEditorLibrary"
    xmlns:theme="clr-namespace:Microsoft.Windows.Themes;assembly=PresentationFramework.Royale"
    xmlns:sys="clr-namespace:System;assembly=mscorlib" 
    Name="m_Crl">

    <UserControl.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <!--ResourceDictionary Source="..\Resources\Styles\MainViewStyles.xaml"/-->
            </ResourceDictionary.MergedDictionaries>

            <local:ColorToBrushConverter x:Key="ColBrushConv" />
            <!-- Brushes -->
            <SolidColorBrush x:Key="DisabledForegroundBrush" Color="#888" />
            <SolidColorBrush x:Key="DisabledBackgroundBrush" Color="#EEE" />
            <SolidColorBrush x:Key="WindowBackgroundBrush" Color="#FFF" />
            <SolidColorBrush x:Key="SelectedBackgroundBrush" Color="#DDD" />
            <SolidColorBrush x:Key="SolidBlack" Color="Black"/>
            <SolidColorBrush x:Key="SolidSilver" Color="Silver"/>
            <LinearGradientBrush x:Key="NormalBrush" 
                                 StartPoint="0,0" 
                                 EndPoint="0,1">
                <GradientBrush.GradientStops>
                    <GradientStopCollection>
                        <GradientStop Color="#FFF" 
                                      Offset="0.0"/>
                        <GradientStop Color="#CCC" 
                                      Offset="1.0"/>
                    </GradientStopCollection>
                </GradientBrush.GradientStops>
            </LinearGradientBrush>

            <LinearGradientBrush x:Key="HorizontalNormalBrush" 
                                 StartPoint="0,0" 
                                 EndPoint="1,0">
                <GradientBrush.GradientStops>
                    <GradientStopCollection>
                        <GradientStop Color="#FFF" 
                                      Offset="0.0"/>
                        <GradientStop Color="#CCC" 
                                      Offset="1.0"/>
                    </GradientStopCollection>
                </GradientBrush.GradientStops>
            </LinearGradientBrush>

            <LinearGradientBrush x:Key="LightBrush" 
                                 StartPoint="0,0" 
                                 EndPoint="0,1">
                <GradientBrush.GradientStops>
                    <GradientStopCollection>
                        <GradientStop Color="#FFF" 
                                      Offset="0.0"/>
                        <GradientStop Color="#EEE"
                                      Offset="1.0"/>
                    </GradientStopCollection>
                </GradientBrush.GradientStops>
            </LinearGradientBrush>

            <LinearGradientBrush x:Key="HorizontalLightBrush" 
                                 StartPoint="0,0" 
                                 EndPoint="1,0">
                <GradientBrush.GradientStops>
                    <GradientStopCollection>
                        <GradientStop Color="#FFF" 
                                      Offset="0.0"/>
                        <GradientStop Color="#EEE" 
                                      Offset="1.0"/>
                    </GradientStopCollection>
                </GradientBrush.GradientStops>
            </LinearGradientBrush>

            <LinearGradientBrush x:Key="DarkBrush" 
                                 StartPoint="0,0" 
                                 EndPoint="0,1">
                <GradientBrush.GradientStops>
                    <GradientStopCollection>
                        <GradientStop Color="#FFF" 
                                      Offset="0.0"/>
                        <GradientStop Color="#AAA" 
                                      Offset="1.0"/>
                    </GradientStopCollection>
                </GradientBrush.GradientStops>
            </LinearGradientBrush>

            <LinearGradientBrush x:Key="PressedBrush" 
                                 StartPoint="0,0" 
                                 EndPoint="0,1">
                <GradientBrush.GradientStops>
                    <GradientStopCollection>
                        <GradientStop Color="#BBB" 
                                      Offset="0.0"/>
                        <GradientStop Color="#EEE" 
                                      Offset="0.1"/>
                        <GradientStop Color="#EEE" 
                                      Offset="0.9"/>
                        <GradientStop Color="#FFF" 
                                      Offset="1.0"/>
                    </GradientStopCollection>
                </GradientBrush.GradientStops>
            </LinearGradientBrush>

            <LinearGradientBrush x:Key="NormalBorderBrush" 
                                 StartPoint="0,0" 
                                 EndPoint="0,1">
                <GradientBrush.GradientStops>
                    <GradientStopCollection>
                        <GradientStop Color="#CCC" 
                                      Offset="0.0"/>
                        <GradientStop Color="#444" 
                                      Offset="1.0"/>
                    </GradientStopCollection>
                </GradientBrush.GradientStops>
            </LinearGradientBrush>

            <LinearGradientBrush x:Key="HorizontalNormalBorderBrush" 
                                 StartPoint="0,0" 
                                 EndPoint="1,0">
                <GradientBrush.GradientStops>
                    <GradientStopCollection>
                        <GradientStop Color="#CCC" 
                                      Offset="0.0"/>
                        <GradientStop Color="#444" 
                                      Offset="1.0"/>
                    </GradientStopCollection>
                </GradientBrush.GradientStops>
            </LinearGradientBrush>

            <LinearGradientBrush x:Key="DefaultedBorderBrush" 
                                 StartPoint="0,0" 
                                 EndPoint="0,1">
                <GradientBrush.GradientStops>
                    <GradientStopCollection>
                        <GradientStop Color="#777" 
                                      Offset="0.0"/>
                        <GradientStop Color="#000" 
                                      Offset="1.0"/>
                    </GradientStopCollection>
                </GradientBrush.GradientStops>
            </LinearGradientBrush>

            <LinearGradientBrush x:Key="PressedBorderBrush" 
                                 StartPoint="0,0" 
                                 EndPoint="0,1">
                <GradientBrush.GradientStops>
                    <GradientStopCollection>
                        <GradientStop Color="#444" 
                                      Offset="0.0"/>
                        <GradientStop Color="#888" 
                                      Offset="1.0"/>
                    </GradientStopCollection>
                </GradientBrush.GradientStops>
            </LinearGradientBrush>

            <SolidColorBrush x:Key="DisabledBorderBrush" 
                             Color="#AAA" />

            <SolidColorBrush x:Key="SolidBorderBrush" 
                             Color="#888" />

            <SolidColorBrush x:Key="LightBorderBrush" 
                             Color="#AAA" />

            <!-- Miscellaneous Brushes -->
            <SolidColorBrush x:Key="GlyphBrush" 
                             Color="#444" />

            <SolidColorBrush x:Key="LightColorBrush" 
                             Color="#DDD" />

            <ControlTemplate x:Key="ComboBoxToggleButton" 
                             TargetType="ToggleButton">
                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition />
                        <ColumnDefinition Width="20" />
                    </Grid.ColumnDefinitions>
                    <Border
              x:Name="Border" 
              Grid.ColumnSpan="2"
              CornerRadius="2"
              Background="{StaticResource NormalBrush}"
              BorderBrush="{StaticResource NormalBorderBrush}"
              BorderThickness="1" />
                    <Border 
              Grid.Column="0"
              CornerRadius="2,0,0,2" 
              Margin="1" 
              Background="{StaticResource WindowBackgroundBrush}" 
              BorderBrush="{StaticResource NormalBorderBrush}"
              BorderThickness="0,0,1,0" />
                    <Path 
              x:Name="Arrow"
              Grid.Column="1"     
              Fill="{StaticResource GlyphBrush}"
              HorizontalAlignment="Center"
              VerticalAlignment="Center"
              Data="M 0 0 L 4 4 L 8 0 Z"/>
                </Grid>
                <ControlTemplate.Triggers>
                    <Trigger Property="ToggleButton.IsMouseOver" 
                             Value="true">
                        <Setter TargetName="Border" 
                                Property="Background" 
                                Value="{StaticResource DarkBrush}" />
                    </Trigger>
                    <Trigger Property="ToggleButton.IsChecked" 
                             Value="true">
                        <Setter TargetName="Border" 
                                Property="Background" 
                                Value="{StaticResource PressedBrush}" />
                    </Trigger>
                    <Trigger Property="IsEnabled" 
                             Value="False">
                        <Setter TargetName="Border" 
                                Property="Background" 
                                Value="{StaticResource DisabledBackgroundBrush}" />
                        <Setter TargetName="Border" 
                                Property="BorderBrush" 
                                Value="{StaticResource DisabledBorderBrush}" />
                        <Setter Property="Foreground" 
                                Value="{StaticResource DisabledForegroundBrush}"/>
                        <Setter TargetName="Arrow" 
                                Property="Fill" 
                                Value="{StaticResource DisabledForegroundBrush}" />
                    </Trigger>
                </ControlTemplate.Triggers>
            </ControlTemplate>

            <Style TargetType="{x:Type	Menu}">
                <Setter Property="Menu.Background">
                    <Setter.Value>
                        <LinearGradientBrush StartPoint="0,0" 
                                             EndPoint="0,1">
                            <LinearGradientBrush.GradientStops>
                                <GradientStop Color="#FFFFFF"
											  Offset="0.15"/>
                                <GradientStop Color="#D6E7EF"
											  Offset=".4"/>
                                <GradientStop Color="#BDD7EF"
											  Offset=".65"/>
                                <GradientStop Color="#A5CBE7"
											  Offset=".65"/>
                                <GradientStop Color="#A5CBE7"
											  Offset=".75"/>
                                <GradientStop Color="#ADD3EF"
											  Offset=".75"/>
                                <GradientStop Color="#ADD7EF"
											  Offset="1"/>
                            </LinearGradientBrush.GradientStops>
                        </LinearGradientBrush>
                    </Setter.Value>
                </Setter>
            </Style>

            <!-- ResizeDecorator Default Template -->
            <ControlTemplate x:Key="ResizeDecoratorTemplate" 
                             TargetType="{x:Type Control}">
                <Grid Opacity="0.7" 
                      SnapsToDevicePixels="true">
                    <local:ResizeThumb 
                        Height="3" 
                        Cursor="SizeNS" 
                        Margin="0 -4 0 0"
                        VerticalAlignment="Top" 
                        HorizontalAlignment="Stretch"/>
                    <local:ResizeThumb Width="3" 
                                       Cursor="SizeWE" 
                                       Margin="-4 0 0 0"
                                       VerticalAlignment="Stretch" 
                                       HorizontalAlignment="Left"/>
                    <local:ResizeThumb Width="3" 
                                       Cursor="SizeWE" 
                                       Margin="0 0 -4 0"
                                       VerticalAlignment="Stretch" 
                                       HorizontalAlignment="Right"/>
                    <local:ResizeThumb Height="3" 
                                       Cursor="SizeNS" 
                                       Margin="0 0 0 -4"
                                       VerticalAlignment="Bottom" 
                                       HorizontalAlignment="Stretch"/>
                    <local:ResizeThumb Width="7" 
                                       Height="7" 
                                       Cursor="SizeNWSE" 
                                       Margin="-6 -6 0 0"
                                       VerticalAlignment="Top" 
                                       HorizontalAlignment="Left"/>
                    <local:ResizeThumb Width="7" 
                                       Height="7" 
                                       Cursor="SizeNESW" 
                                       Margin="0 -6 -6 0"
                                       VerticalAlignment="Top" 
                                       HorizontalAlignment="Right"/>
                    <local:ResizeThumb Width="7" 
                                       Height="7" 
                                       Cursor="SizeNESW" 
                                       Margin="-6 0 0 -6"
                                       VerticalAlignment="Bottom" 
                                       HorizontalAlignment="Left"/>
                    <local:ResizeThumb Width="7" 
                                       Height="7" 
                                       Cursor="SizeNWSE" 
                                       Margin="0 0 -6 -6"
                                       VerticalAlignment="Bottom" 
                                       HorizontalAlignment="Right"/>
                </Grid>
            </ControlTemplate>
            
            <!-- Context menu -->
            <ContextMenu x:Key="RTEditorContextMenu">
                <MenuItem Header="Cut" 
                          Command="{x:Static ApplicationCommands.Cut}">
                    <MenuItem.Icon>
                        <Image Source="Resources\Cut.png" 
                               Width="16"/>
                    </MenuItem.Icon>
                </MenuItem>
                <MenuItem Header="Copy" 
                          Command="{x:Static ApplicationCommands.Copy}">
                    <MenuItem.Icon>
                        <Image Source="Resources\Copy.png" 
                               Width="16"/>
                    </MenuItem.Icon>
                </MenuItem>
                <MenuItem Header="Paste" 
                          Command="{x:Static ApplicationCommands.Paste}">
                    <MenuItem.Icon>
                        <Image Source="Resources\editpaste.png" 
                               Width="16"/>
                    </MenuItem.Icon>
                </MenuItem>
                <Separator/>
                <!--MenuItem Header="Tisk" Command="{x:Static custom:RichTextEditor.PrintCommand}">
                    <MenuItem.Icon>
                        <Image Source="Resources\Print.png" Width="16"/>
                    </MenuItem.Icon>
                </MenuItem>
                <Separator/-->
                <MenuItem Header="Properties" 
                          Command="{x:Static local:MiscCommands.PropertiesCommand}">
                    <MenuItem.Icon>
                        <Image Source="Resources\properties.png" 
                               Width="16"/>
                    </MenuItem.Icon>
                </MenuItem>

                <MenuItem Header="Insert picture" 
                          Command="{x:Static local:PictureCommands.InsertPictureCommand}">
                    <MenuItem.Icon>
                        <Image Source="Resources\properties.png" Width="16"/>
                    </MenuItem.Icon>
                </MenuItem>
            </ContextMenu>
        </ResourceDictionary>
    </UserControl.Resources>

    <!--UserControl.CommandBindings>

        <CommandBinding Command="views:AcmUICommands.SendCommand"
                        />
    </UserControl.CommandBindings-->

    <Grid>
        <DockPanel>
           
                <!-- ################ RIBON START ################ -->
            <r:Ribbon DockPanel.Dock="Top" Name="m_ribbon" Title="{Binding Path=DocTitle2}">
                <r:Ribbon.Resources>

                    <!-- Quick Access Toolbar Command -->
                    <r:RibbonCommand x:Key="SaveDocCommand"  
                                     Executed="SaveDocCommandExecuted"
                                     SmallImageSource="Resources\floppy.png"                                     
                                     LargeImageSource="Resources\floppy.png"                                 
                                     ToolTipTitle="Save item"
                                     ToolTipDescription="(Alt+S)" />
                    <!--<r:RibbonCommand x:Key="SaveAsDocCommand"  
                                         Executed="SaveAsDocCommandExecuted"
                                         SmallImageSource="Resources\floppy_multiple.png"                                     
                                         LargeImageSource="Resources\floppy_multiple.png"                                 
                                         ToolTipTitle="Save As"
                                         ToolTipDescription="(Alt+A)" />
                    <r:RibbonCommand x:Key="OpenDocCommand"
                                     Executed="OpenDocCommandExecuted"
                                     SmallImageSource="Resources\folder.png"                                     
                                     LargeImageSource="Resources\folder.png"
                                     ToolTipTitle="Open"
                                     ToolTipDescription="(Ctrl+O)" />

                    <r:RibbonCommand x:Key="NewDocCommand"
                                     Executed="NewDocCommandExecuted"
                                     SmallImageSource="Resources\page_white.png"                                     
                                     LargeImageSource="Resources\page_white.png"
                                     ToolTipTitle="New"
                                     ToolTipDescription="(Ctrl+N)" />-->
                    
                    <r:RibbonCommand x:Key="UndoCommand"
                                     Executed="UndoCommandExecuted"
                                     SmallImageSource="Resources\undo.png"                                     
                                     LargeImageSource="Resources\undo.png"
                                     LabelTitle="Undo"
                                     ToolTipTitle="Undo"
                                     ToolTipDescription="(Ctrl+Z)" />
                    <r:RibbonCommand x:Key="RedoCommand"
                                     Executed="RedoCommandExecuted"
                                     SmallImageSource="Resources\redo.png"                                     
                                     LargeImageSource="Resources\redo.png"
                                     LabelTitle="Redo"
                                     ToolTipTitle="Redo"
                                     ToolTipDescription="(Ctrl+Y)" />

                    <!--<r:RibbonCommand x:Key="PrintCommand"
                                         Executed="PrintCommandExecuted"
                                         SmallImageSource="Resources\printer.png"                                     
                                         LargeImageSource="Resources\printer.png"
                                         LabelTitle="Print"
                                         ToolTipTitle="Print"
                                         ToolTipDescription="Print Comment" />-->
                    
                    <r:RibbonCommand x:Key="FontColorCommand"
                                     Executed="FontColorCommandExecuted" 
                                     SmallImageSource="Resources\highlight.png"                                     
                                     LargeImageSource="Resources\highlight.png"
                                     LabelTitle="Font Color"
                                     ToolTipTitle="Font Color"
                                     ToolTipDescription="Nastaví barvu fontu" />                    
                    
                    <r:RibbonCommand x:Key="FontBackgroundColorCommand"
                                     Executed="FontBackgroundColorCommandExecuted" 
                                     SmallImageSource="Resources\fill32.png"                                     
                                     LargeImageSource="Resources\fill32.png"
                                     LabelTitle="Font background colour"
                                     ToolTipTitle="Font background colour"
                                     ToolTipDescription="Font background colour" />                    
                    <!-- Quick Access Toolbar Command -->

                    <!-- Personal Tab -->
                    <!-- Replies Group -->
                    <r:RibbonCommand x:Key="PasteCommand"
                                     Executed="PasteCommandExecuted"
                                     SmallImageSource="Resources\editpaste.png"                                     
                                     LargeImageSource="Resources\editpaste.png"
                                     LabelTitle="Paste"
                                     ToolTipTitle="Paste"
                                     ToolTipImageSource="Resources\editpaste.png"
                                     ToolTipDescription="Paste text from clipboard" />
                    <r:RibbonCommand x:Key="CutCommand" 
                                     Executed="CutCommandExecuted"
                                     SmallImageSource="Resources\Cut.png"                                     
                                     LargeImageSource="Resources\Cut.png"
                                     LabelTitle="Cut"
                                     ToolTipTitle="Cut"
                                     ToolTipImageSource="Resources\Cut.png"
                                     ToolTipDescription="Cut selected text" />

                    <r:RibbonCommand x:Key="CopyCommand" 
                                     Executed="CopyCommandExecuted"
                                     SmallImageSource="Resources\Copy.png"                                     
                                     LargeImageSource="Resources\Copy.png"
                                     LabelTitle="Copy"
                                     ToolTipTitle="Copy"
                                     ToolTipImageSource="Resources\Copy.png"
                                     ToolTipDescription="Copy selected text to clipboard"/>

                    <r:RibbonCommand x:Key="InsertTableCommand" 
                                     Executed="InsertTableCommandExecuted"
                                     SmallImageSource="Resources\table.png"                                     
                                     LargeImageSource="Resources\table.png"
                                     LabelTitle="Insert table"
                                     ToolTipTitle="Insert table"
                                     ToolTipImageSource="Resources\table.png"
                                     ToolTipDescription="Insert a table into the document" />

                    <r:RibbonCommand x:Key="InsertLineCommand" 
                                     Executed="InsertLineCommandExecuted"
                                     SmallImageSource="Resources\signatureline.png"                                     
                                     LargeImageSource="Resources\signatureline.png"
                                     LabelTitle="Newline"
                                     ToolTipTitle="Newline"
                                     ToolTipImageSource="Resources\signatureline.png"
                                     ToolTipDescription="Insert a new line" />

                    <r:RibbonCommand x:Key="BoldCommand" 
                                     Executed="BoldCommandExecuted"
                                     SmallImageSource="Resources\CharacterBold.png"                                     
                                     LargeImageSource="Resources\CharacterBold.png"
                                     LabelTitle="Bold"
                                     ToolTipTitle="Bold"
                                     ToolTipImageSource="Resources\CharacterBold.png"
                                     ToolTipDescription="Bold selected text" />

                    <r:RibbonCommand x:Key="ItalicCommand" 
                                     Executed="ItalicCommandExecuted"
                                     SmallImageSource="Resources\CharacterItalic.png"                                     
                                     LargeImageSource="Resources\CharacterItalic.png"
                                     LabelTitle="Italic"
                                     ToolTipTitle="Italic"
                                     ToolTipImageSource="Resources\CharacterItalic.png"
                                     ToolTipDescription="Make text intalic" />

                    <r:RibbonCommand x:Key="UnderlineCommand" 
                                     Executed="UnderlineCommandExecuted"
                                     SmallImageSource="Resources\CharacterUnderline.png"                                     
                                     LargeImageSource="Resources\CharacterUnderline.png"
                                     LabelTitle="Underline"
                                     ToolTipTitle="Underline"
                                     ToolTipImageSource="Resources\CharacterUnderline.png"
                                     ToolTipDescription="Underline the selected text" />

                    <r:RibbonCommand x:Key="SpellCheckCommand" 
                                                     Executed="SpellCheckCommandExecuted"
                                                     SmallImageSource="Resources\spellcheck.png"                                     
                                                     LargeImageSource="Resources\spellcheck.png"
                                                     LabelTitle="Spell check"
                                                     ToolTipTitle="Spell check."
                                                     ToolTipImageSource="Resources\spellcheck.png"
                                                     ToolTipDescription="Check spelling" />

                    <r:RibbonCommand x:Key="NumberingCommand" 
                                                     Executed="NumberingCommandExecuted"
                                                     SmallImageSource="Resources\text_list_numbers.png"                                     
                                                     LargeImageSource="Resources\text_list_numbers.png"
                                                     LabelTitle="Numbered list"
                                                     ToolTipTitle="Numbered List"
                                                     ToolTipImageSource="Resources\text_list_numbers.png"
                                                     ToolTipDescription="Create a numbered list" />

                    <r:RibbonCommand x:Key="BulletsCommand" 
                                                     Executed="BulletsCommandExecuted"
                                                     SmallImageSource="Resources\text_list_bullets.png"                                     
                                                     LargeImageSource="Resources\text_list_bullets.png"
                                                     LabelTitle="Bulleted list"
                                                     ToolTipTitle="Bulleted List"
                                                     ToolTipImageSource="Resources\text_list_bullets.png"
                                                     ToolTipDescription="Create a bulleted list" />

                    <r:RibbonCommand x:Key="DecreaseCommand" 
                                                     Executed="DecreaseCommandExecuted"
                                                     SmallImageSource="Resources\text_indent_remove.png"                                     
                                                     LargeImageSource="Resources\text_indent_remove.png"
                                                     LabelTitle="Decrease indent"
                                                     ToolTipTitle="Decrease Indent"
                                                     ToolTipImageSource="Resources\text_indent_remove.png"
                                                     ToolTipDescription="Decrease text indentation" />

                    <r:RibbonCommand x:Key="IncreaseCommand" 
                                                     Executed="IncreaseCommandExecuted"
                                                     SmallImageSource="Resources\text_indent.png"                                     
                                                     LargeImageSource="Resources\text_indent.png"
                                                     LabelTitle="Increase indent"
                                                     ToolTipTitle="Increase indent"
                                                     ToolTipImageSource="Resources\text_indent.png"
                                                     ToolTipDescription="Increase indent of selected text" />

                    <r:RibbonCommand x:Key="LeftCommand" 
                                                     Executed="LeftCommandExecuted"
                                                     SmallImageSource="Resources\text_align_left.png"                                     
                                                     LargeImageSource="Resources\text_align_left.png"
                                                     LabelTitle="Left justify"
                                                     ToolTipTitle="Left Justify"
                                                     ToolTipImageSource="Resources\text_align_left.png"
                                                     ToolTipDescription="Align text on the left border" />

                    <r:RibbonCommand x:Key="RightCommand" 
                                                     Executed="RightCommandExecuted"
                                                     SmallImageSource="Resources\text_align_right.png"                                     
                                                     LargeImageSource="Resources\text_align_right.png"
                                                     LabelTitle="Right justify"
                                                     ToolTipTitle="Right Justify"
                                                     ToolTipImageSource="Resources\text_align_right.png"
                                                     ToolTipDescription="Align text with the right side of document"
                                     />

                    <r:RibbonCommand x:Key="CenterCommand" 
                                                     Executed="CenterCommandExecuted"
                                                     SmallImageSource="Resources\text_align_center.png"                                     
                                                     LargeImageSource="Resources\text_align_center.png"
                                                     LabelTitle="Centre text"
                                                     ToolTipTitle="Centre Text"
                                                     ToolTipImageSource="Resources\text_align_center.png"
                                                     ToolTipDescription="Align text with the centre of the document"
                                     />

                    <r:RibbonCommand x:Key="JustifyCommand" 
                                                     Executed="JustifyCommandExecuted"
                                                     SmallImageSource="Resources\text_align_justify.png"                                     
                                                     LargeImageSource="Resources\text_align_justify.png"
                                                     LabelTitle="Justify"
                                                     ToolTipTitle="Justify Text"
                                                     ToolTipImageSource="Resources\text_align_justify.png"
                                                     ToolTipDescription="Justify both left and right edges of text"
                                     />

                    <r:RibbonCommand x:Key="InsertRowDownCommand" 
                                                     Executed="InsertRowDownCommandExecuted"
                                                     SmallImageSource="Resources\table_row_insert_down.png"                                     
                                                     LargeImageSource="Resources\table_row_insert_down.png"
                                                     LabelTitle="Insert row down"
                                                     ToolTipTitle="Insert row down"
                                                     ToolTipImageSource="Resources\table_row_insert_down.png"
                                                     ToolTipDescription="Insert a new row on the bottom" />

                    <r:RibbonCommand x:Key="InsertRowUpCommand" 
                                                     Executed="InsertRowUpCommandExecuted"
                                                     SmallImageSource="Resources\table_row_insert_up.png"                                     
                                                     LargeImageSource="Resources\table_row_insert_up.png"
                                                     LabelTitle="Insert row up"
                                                     ToolTipTitle="Insert row up"
                                                     ToolTipImageSource="Resources\table_row_insert_up.png"
                                                     ToolTipDescription="Insert row at the top" />

                    <r:RibbonCommand x:Key="InsertColumnLeftCommand" 
                                                     Executed="InsertColumnLeftCommandExecuted"
                                                     SmallImageSource="Resources\table_col_insert_left.png"                                     
                                                     LargeImageSource="Resources\table_col_insert_left.png"
                                                     LabelTitle="Insert column left"
                                                     ToolTipTitle="Insert column left"
                                                     ToolTipImageSource="Resources\table_col_insert_left.png"
                                                     ToolTipDescription="Insert column to the left of the table" />

                    <r:RibbonCommand x:Key="InsertColumnRightCommand" 
                                                     Executed="InsertColumnRightCommandExecuted"
                                                     SmallImageSource="Resources\table_col_insert_rigt.png"                                     
                                                     LargeImageSource="Resources\table_col_insert_rigt.png"
                                                     LabelTitle="Insert column right"
                                                     ToolTipTitle="Insert column right"
                                                     ToolTipImageSource="Resources\table_col_insert_left.png"
                                                     ToolTipDescription="Insert column to the right of the table" />

                    <r:RibbonCommand x:Key="DelRowCommand" 
                                                     Executed="DelRowCommandExecuted"
                                                     SmallImageSource="Resources\table_row_delete.png"                                     
                                                     LargeImageSource="Resources\table_row_delete.png"
                                                     LabelTitle="Delete row"
                                                     ToolTipTitle="Delete row"
                                                     ToolTipImageSource="Resources\table_row_delete.png"
                                                     ToolTipDescription="Delete selected row" />

                    <r:RibbonCommand x:Key="DelColCommand" 
                                                     Executed="DelColCommandExecuted"
                                                     SmallImageSource="Resources\table_col_delete.png"                                     
                                                     LargeImageSource="Resources\table_col_delete.png"
                                                     LabelTitle="Delete column"
                                                     ToolTipTitle="Delete column"
                                                     ToolTipImageSource="Resources\table_col_delete.png"
                                                     ToolTipDescription="Delete selected column" />

                    <r:RibbonCommand x:Key="DelTableCommand" 
                                                     Executed="DelTableCommandExecuted"
                                                     SmallImageSource="Resources\table_delete.png"                                     
                                                     LargeImageSource="Resources\table_delete.png"
                                                     LabelTitle="Delete Table"
                                                     ToolTipTitle="Delete Table"
                                                     ToolTipImageSource="Resources\table_delete.png"
                                                     ToolTipDescription="Delete selected table" />

                    <r:RibbonCommand x:Key="InsertPictureCommand" 
                                                     Executed="InsertPictureCommandExecuted"
                                                     
                                                     SmallImageSource="Resources\InsertImage.png"                                     
                                                     LargeImageSource="Resources\InsertImage.png"
                                                     LabelTitle="Insert picture"
                                                     ToolTipTitle="Insert picture"
                                                     ToolTipImageSource="Resources\InsertImage.png"
                                                     ToolTipDescription="Insert picture into document" />

                    <r:RibbonCommand x:Key="InsertHyperlinkCommand" 
                                                     Executed="InsertHyperlinkCommandExecuted"
                                                     SmallImageSource="Resources\InsertHyperlink.png"                                     
                                                     LargeImageSource="Resources\InsertHyperlink.png"
                                                     LabelTitle="Hyperlink"
                                                     ToolTipTitle="Hyperlink"
                                                     ToolTipImageSource="Resources\InsertHyperlink.png"
                                                     ToolTipDescription="Add hyperlink to the document" />

                    <r:RibbonCommand x:Key="InsertActiveTextCommand" 
                                                     Executed="InsertActiveTextCommandExecuted"
                                                     SmallImageSource="Resources\vcard.png"                                     
                                                     LargeImageSource="Resources\vcard.png"
                                                     LabelTitle="Insert active text"
                                                     ToolTipTitle="Insert active text"
                                                     ToolTipImageSource="Resources\vcard_big.png"
                                                     ToolTipDescription="Insert active text into document" />


                    <!-- Application Menu 
                    <r:RibbonCommand x:Key="TweetyApplicationMenu"                                     
                                                     SmallImageSource="Resources\OfficeV2_48x48.png"
                                                     LargeImageSource="Resources\OfficeV2_48x48.png"
                                                     LabelTitle="Tweety"
                                                     ToolTipImageSource="Resources\OfficeV2_48x48.png"
                                                     ToolTipTitle="Tweety"
                                                     ToolTipDescription="Yet another twitter client" />-->
                    <!-- Application Menu -->

                    <!-- Layout Definitions -->
                    <r:RibbonGroupSizeDefinitionCollection x:Key="RibbonLayoutClipboard">
                        <r:RibbonGroupSizeDefinition>
                            <r:RibbonControlSizeDefinition ImageSize="Large" 
                                                           IsLabelVisible="True"/>
                            <r:RibbonControlSizeDefinition ImageSize="Small" 
                                                           IsLabelVisible="True"/>
                            <r:RibbonControlSizeDefinition ImageSize="Small" 
                                                           IsLabelVisible="True"/>
                            <r:RibbonControlSizeDefinition ImageSize="Small" 
                                                           IsLabelVisible="True"/>
                        </r:RibbonGroupSizeDefinition>
                        <r:RibbonGroupSizeDefinition IsCollapsed="True" />
                    </r:RibbonGroupSizeDefinitionCollection>

                    <r:RibbonGroupSizeDefinitionCollection x:Key="RibbonLayoutFont">
                        <r:RibbonGroupSizeDefinition>
                            <r:RibbonControlSizeDefinition ImageSize="Large" 
                                                           IsLabelVisible="True"/>
                            <r:RibbonControlSizeDefinition ImageSize="Large" 
                                                           IsLabelVisible="True"/>
                            <r:RibbonControlSizeDefinition ImageSize="Small" 
                                                           IsLabelVisible="False"/>
                            <r:RibbonControlSizeDefinition ImageSize="Small" 
                                                           IsLabelVisible="False"/>
                            <r:RibbonControlSizeDefinition ImageSize="Small" 
                                                           IsLabelVisible="False"/>
                            <r:RibbonControlSizeDefinition ImageSize="Small" 
                                                           IsLabelVisible="False"/>
                            <r:RibbonControlSizeDefinition ImageSize="Small" 
                                                           IsLabelVisible="False"/>
                            <r:RibbonControlSizeDefinition ImageSize="Small" 
                                                           IsLabelVisible="False"/>
                            <r:RibbonControlSizeDefinition ImageSize="Small" 
                                                           IsLabelVisible="False"/>
                            <r:RibbonControlSizeDefinition ImageSize="Small" 
                                                           IsLabelVisible="False"/>
                        </r:RibbonGroupSizeDefinition>
                        <r:RibbonGroupSizeDefinition IsCollapsed="True" />
                    </r:RibbonGroupSizeDefinitionCollection>

                    <r:RibbonGroupSizeDefinitionCollection x:Key="RibbonLayoutParagrapg">
                        <r:RibbonGroupSizeDefinition>
                            <r:RibbonControlSizeDefinition ImageSize="Small" 
                                                           IsLabelVisible="True"/>
                            <r:RibbonControlSizeDefinition ImageSize="Small" 
                                                           IsLabelVisible="True"/>
                            <r:RibbonControlSizeDefinition ImageSize="Small" 
                                                           IsLabelVisible="True"/>
                            <r:RibbonControlSizeDefinition ImageSize="Small" 
                                                           IsLabelVisible="True"/>
                        </r:RibbonGroupSizeDefinition>
                        <r:RibbonGroupSizeDefinition IsCollapsed="True" />
                    </r:RibbonGroupSizeDefinitionCollection>

                    <r:RibbonGroupSizeDefinitionCollection x:Key="RibbonLayoutInsert">
                        <r:RibbonGroupSizeDefinition>
                            <r:RibbonControlSizeDefinition ImageSize="Large" 
                                                           IsLabelVisible="True"/>
                            <r:RibbonControlSizeDefinition ImageSize="Large" 
                                                           IsLabelVisible="True"/>
                            <r:RibbonControlSizeDefinition ImageSize="Large" 
                                                           IsLabelVisible="True"/>
                            <r:RibbonControlSizeDefinition ImageSize="Small" 
                                                           IsLabelVisible="True"/>
                        </r:RibbonGroupSizeDefinition>
                        <r:RibbonGroupSizeDefinition IsCollapsed="True" />
                    </r:RibbonGroupSizeDefinitionCollection>

                    <r:RibbonGroupSizeDefinitionCollection x:Key="RibbonLayoutTable">
                        <r:RibbonGroupSizeDefinition>
                            <r:RibbonControlSizeDefinition ImageSize="Large" 
                                                           IsLabelVisible="True"/>
                            <r:RibbonControlSizeDefinition ImageSize="Small" 
                                                           IsLabelVisible="True"/>
                            <r:RibbonControlSizeDefinition ImageSize="Small" 
                                                           IsLabelVisible="True"/>
                            <r:RibbonControlSizeDefinition ImageSize="Small" 
                                                           IsLabelVisible="True"/>
                            <r:RibbonControlSizeDefinition ImageSize="Small" 
                                                           IsLabelVisible="True"/>
                            <r:RibbonControlSizeDefinition ImageSize="Small" 
                                                           IsLabelVisible="True"/>
                            <r:RibbonControlSizeDefinition ImageSize="Small" 
                                                           IsLabelVisible="True"/>
                            <r:RibbonControlSizeDefinition ImageSize="Small" 
                                                           IsLabelVisible="True"/>
                            <r:RibbonControlSizeDefinition ImageSize="Small" 
                                                           IsLabelVisible="True"/>
                            <r:RibbonControlSizeDefinition ImageSize="Small" 
                                                           IsLabelVisible="True"/>
                        </r:RibbonGroupSizeDefinition>
                        <r:RibbonGroupSizeDefinition IsCollapsed="True" />
                    </r:RibbonGroupSizeDefinitionCollection>
                    <!-- Layout Definitions -->

                </r:Ribbon.Resources>

                <!-- Building Ribbon starts here with the Application Menu -->
                <r:Ribbon.ApplicationMenu>
                    <r:RibbonApplicationMenu>
                        
                        <r:RibbonApplicationMenu.Command>
                            <r:RibbonCommand  Executed="NullRibonCommand"
                                              LabelTitle="Application Button"
                                              LabelDescription="Close the application."
                                              SmallImageSource="Resources\Word_32x32.png"
                                              LargeImageSource="Resources\Word_32x32.png"
                                              ToolTipTitle="Další nastavení"
                                              ToolTipDescription="Témata editoru..." />
                        </r:RibbonApplicationMenu.Command>
                        

                        
                        <r:RibbonApplicationMenuItem  Name="m_rbmnThemes">
                            
                            <r:RibbonApplicationMenuItem.Command>
                                <r:RibbonCommand 
                                    LabelTitle="Themes" 
                                    LabelDescription="Select the editor theme"
                                    Executed="NullRibonCommand"
                                    LargeImageSource="Resources\windows.png"/>
                            </r:RibbonApplicationMenuItem.Command>

                            
                            <r:RibbonApplicationSplitMenuItem Name="m_rbmn2007Black" >
                                <r:RibbonApplicationSplitMenuItem.Command>
                                    <r:RibbonCommand
                                        LabelTitle="Office 2007 Black" 
                                        LabelDescription="Set editor theme"
                                        Executed="Mn2007BlackCommandExecuted"
                                        LargeImageSource="Resources\black.png"
                                        ToolTipTitle="Office 2007 Black"
                                        ToolTipDescription="Set them to Office 2007 Black"/>
                                </r:RibbonApplicationSplitMenuItem.Command>
                            </r:RibbonApplicationSplitMenuItem>
                            <r:RibbonApplicationSplitMenuItem Name="m_rbmn2007Blue" >
                                <r:RibbonApplicationSplitMenuItem.Command>
                                    <r:RibbonCommand 
                                        LabelTitle="Office 2007 Blue" 
                                        LabelDescription="Set editor theme"
                                        Executed="Mn2007BlueCommandExecuted"
                                        LargeImageSource="Resources\blue.png"
                                        ToolTipTitle="Office 2007 Blue"
                                        ToolTipDescription="Set theme to Office 2007 Blue"/>
                                </r:RibbonApplicationSplitMenuItem.Command>
                            </r:RibbonApplicationSplitMenuItem>
                            <r:RibbonApplicationSplitMenuItem Name="m_rbmn2007Silver"  >
                                <r:RibbonApplicationSplitMenuItem.Command>
                                    <r:RibbonCommand 
                                        LabelTitle="Office 2007 Silver" 
                                        LabelDescription="Set editor theme"
                                        Executed="Mn2007SilverCommandExecuted"
                                        LargeImageSource="Resources\white.png"
                                        ToolTipTitle="Office 2007 Silver"
                                        ToolTipDescription="Set theme to Office 2007 Silver"/>
                                </r:RibbonApplicationSplitMenuItem.Command>
                            </r:RibbonApplicationSplitMenuItem>
                            
                        </r:RibbonApplicationMenuItem>
                        

                        
                        <r:RibbonApplicationMenuItem>
                            <r:RibbonApplicationMenuItem.Command>
                                <r:RibbonCommand/>
                            </r:RibbonApplicationMenuItem.Command>
                        </r:RibbonApplicationMenuItem>
                        <r:RibbonApplicationMenuItem>
                            <r:RibbonApplicationMenuItem.Command>
                                <r:RibbonCommand/>
                            </r:RibbonApplicationMenuItem.Command>
                        </r:RibbonApplicationMenuItem>
                        <r:RibbonApplicationMenuItem>
                            <r:RibbonApplicationMenuItem.Command>
                                <r:RibbonCommand/>
                            </r:RibbonApplicationMenuItem.Command>
                        </r:RibbonApplicationMenuItem>
                         <r:RibbonApplicationMenuItem>
                            <r:RibbonApplicationMenuItem.Command>
                                <r:RibbonCommand/>
                            </r:RibbonApplicationMenuItem.Command>
                        </r:RibbonApplicationMenuItem>
                        <r:RibbonApplicationMenuItem>
                            <r:RibbonApplicationMenuItem.Command>
                                <r:RibbonCommand/>
                            </r:RibbonApplicationMenuItem.Command>
                        </r:RibbonApplicationMenuItem>
                       

                    </r:RibbonApplicationMenu>
                </r:Ribbon.ApplicationMenu>
               

                
                <r:Ribbon.QuickAccessToolBar>
                    <r:RibbonQuickAccessToolBar CanUserCustomize="False">
                        <!--<r:RibbonButton Name="m_rbbtOpenDoc" 
                        Command="{StaticResource OpenDocCommand}"  
                        r:RibbonQuickAccessToolBar.Placement="InToolBar"/>-->
                        <r:RibbonButton Name="m_rbbtSaveDoc" 
                                        Command="{StaticResource SaveDocCommand}" 
                                        Margin="10,0,0,0" 
                                        r:RibbonQuickAccessToolBar.Placement="InToolBar"/>
                        <!--<r:RibbonButton Name="m_rbbtSaveAsDoc" 
                        Command="{StaticResource SaveAsDocCommand}" 
                        r:RibbonQuickAccessToolBar.Placement="InToolBar"/>
                        <r:RibbonButton Name="m_rbbtNewDoc" 
                        Command="{StaticResource NewDocCommand}" 
                        Margin="10,0,0,0" r:RibbonQuickAccessToolBar.Placement="InToolBar"/>-->
                        <r:RibbonButton Name="m_rbbtUndo" 
                                        Command="{StaticResource UndoCommand}" 
                                        Margin="10,0,0,0" 
                                        r:RibbonQuickAccessToolBar.Placement="InCustomizeMenuAndToolBar"/>
                        <r:RibbonButton Name="m_rbbtRedo" 
                                        Command="{StaticResource RedoCommand}" 
                                        r:RibbonQuickAccessToolBar.Placement="InCustomizeMenuAndToolBar"/>
                        <r:RibbonSeparator/>
                        <!--<r:RibbonButton Name="m_rbbtPrint" 
                        Command="{StaticResource PrintCommand}" 
                        Margin="10,0,0,0" 
                        r:RibbonQuickAccessToolBar.Placement="InCustomizeMenuAndToolBar"/>-->
                    </r:RibbonQuickAccessToolBar>
                </r:Ribbon.QuickAccessToolBar>
                

                <!-- Main Tab -->
           
                <r:RibbonTab Name="m_ribTabMain" Label="MikeinHacked">
                    <r:RibbonTab.Groups>
                        <!-- Clipboard Group -->
                        <r:RibbonGroup GroupSizeDefinitions="{StaticResource RibbonLayoutClipboard}" >
                            <r:RibbonGroup.Command>
                                <r:RibbonCommand LabelTitle="Editing"/>
                            </r:RibbonGroup.Command>
                            <r:RibbonButton Name="m_rbbtPaste" 
                                            Command="{StaticResource PasteCommand}" 
                                            Height="Auto" />
                            <r:RibbonButton Name="m_rbbtCut" 
                                            Command="{StaticResource CutCommand}"/>
                            <r:RibbonButton Name="m_rbbtCopy" 
                                            Command="{StaticResource CopyCommand}"/>
                        </r:RibbonGroup>
                        <!-- Clipboard Group -->

                        <!-- Font Group -->
                        <r:RibbonGroup GroupSizeDefinitions="{StaticResource RibbonLayoutFont}" >
                            <r:RibbonGroup.Command>
                                <r:RibbonCommand LabelTitle="Font"/>
                            </r:RibbonGroup.Command>
                            <local:RibbonStackPanel Orientation="Horizontal"  
                                                    Margin="0,5,0,0">
                                <r:RibbonComboBox Name="m_rcbxFontName" 
                                                  ToolTip="Font" 
                                                  Width="120" 
                                                  IsEditable="True" 
                                                  SelectedValuePath="Content" 
                                                  SelectionChanged="OnFontNameSelectionChanged" >
                                    <!--r:RibbonComboBoxItem>Tahoma</r:RibbonComboBoxItem>
                                    <r:RibbonComboBoxItem>Verdana</r:RibbonComboBoxItem>
                                    <r:RibbonComboBoxItem>Arial</r:RibbonComboBoxItem>
                                    <r:RibbonComboBoxItem>Times New Roman</r:RibbonComboBoxItem>
                                    <r:RibbonComboBoxItem>Courier New</r:RibbonComboBoxItem>
                                    <r:RibbonComboBoxItem>Courier New</r:RibbonComboBoxItem-->
                                </r:RibbonComboBox>
                                <r:RibbonComboBox Name="m_rcbxFontSize" 
                                                  ToolTip="Font Size" 
                                                  Width="50" 
                                                  IsEditable="True"
                                                  SelectedValuePath="Content" 
                                                  SelectionChanged="OnFontSizeSelectionChanged" >
                                    <r:RibbonComboBoxItem>7</r:RibbonComboBoxItem>
                                    <r:RibbonComboBoxItem>8</r:RibbonComboBoxItem>
                                    <r:RibbonComboBoxItem>9</r:RibbonComboBoxItem>
                                    <r:RibbonComboBoxItem>10</r:RibbonComboBoxItem>
                                    <r:RibbonComboBoxItem>11</r:RibbonComboBoxItem>
                                    <r:RibbonComboBoxItem>12</r:RibbonComboBoxItem>
                                    <r:RibbonComboBoxItem>13</r:RibbonComboBoxItem>
                                    <r:RibbonComboBoxItem>14</r:RibbonComboBoxItem>
                                    <r:RibbonComboBoxItem>15</r:RibbonComboBoxItem>
                                    <r:RibbonComboBoxItem>16</r:RibbonComboBoxItem>
                                    <r:RibbonComboBoxItem>17</r:RibbonComboBoxItem>
                                    <r:RibbonComboBoxItem>18</r:RibbonComboBoxItem>
                                    <r:RibbonComboBoxItem>19</r:RibbonComboBoxItem>
                                    <r:RibbonComboBoxItem>20</r:RibbonComboBoxItem>
                                    <r:RibbonComboBoxItem>22</r:RibbonComboBoxItem>
                                    <r:RibbonComboBoxItem>24</r:RibbonComboBoxItem>
                                    <r:RibbonComboBoxItem>26</r:RibbonComboBoxItem>
                                    <r:RibbonComboBoxItem>28</r:RibbonComboBoxItem>
                                    <r:RibbonComboBoxItem>36</r:RibbonComboBoxItem>
                                    <r:RibbonComboBoxItem>48</r:RibbonComboBoxItem>
                                    <r:RibbonComboBoxItem>72</r:RibbonComboBoxItem>
                                </r:RibbonComboBox>
                            </local:RibbonStackPanel>


                            <!--local:RibbonStackPanel Orientation="Horizontal"  Margin="0,5,0,0"-->
                                <r:RibbonControlGroup Margin="0,5,0,0">
                                    <r:RibbonToggleButton Name="m_rbtbBold"  
                                                          Command="{StaticResource BoldCommand}"/>
                                <r:RibbonToggleButton Name="m_rbtbItalic"  
                                                      Command="{StaticResource ItalicCommand}"/>
                                <r:RibbonToggleButton Name="m_rbtbUnderline"  
                                                      Command="{StaticResource UnderlineCommand}"/>

                                <r:RibbonDropDownButton Name="m_rbtbFontColor" 
                                                        Command="{StaticResource FontColorCommand}" 
                                                        Margin="8,0,0,0">
                                    <r:RibbonGroupPanel >
                                        <local:ColorPick x:Name="m_colorPickerFont"/>
                                    </r:RibbonGroupPanel>
                                </r:RibbonDropDownButton>

                                <r:RibbonDropDownButton Name="m_rbtbFontBackgroundColor" 
                                                        Command="{StaticResource FontBackgroundColorCommand}" 
                                                        Margin="8,0,0,0">
                                    <r:RibbonGroupPanel >
                                        <local:ColorPick x:Name="m_colorBackgroundPickerFont"/>
                                    </r:RibbonGroupPanel>

                                </r:RibbonDropDownButton>

                            </r:RibbonControlGroup>
                                
                            <!--/local:RibbonStackPanel-->


                            <r:RibbonControlGroup Margin="0,5,0,0">
                                <r:RibbonToggleButton Name="m_rbtbSpellCheck" IsChecked="false"  
                                                      Command="{StaticResource SpellCheckCommand}"/>
                            </r:RibbonControlGroup>
                        </r:RibbonGroup>
                        <!-- Font Group -->

                        <!-- Paragraph Group -->
                        <r:RibbonGroup GroupSizeDefinitions="{StaticResource RibbonLayoutParagrapg}" >
                            <r:RibbonGroup.Command>
                                <r:RibbonCommand LabelTitle="Formatting"/>
                            </r:RibbonGroup.Command>
                            <local:RibbonStackPanel Orientation="Horizontal"  
                                                    Margin="0,5,0,0">
                                <r:RibbonControlGroup Margin="0,5,0,0">
                                    <r:RibbonToggleButton Name="m_rbtbNumbering" 
                                                          Command="{StaticResource NumberingCommand}"/>
                                    <r:RibbonToggleButton Name="m_rbtbBullets" 
                                                          Command="{StaticResource BulletsCommand}"/>
                                </r:RibbonControlGroup>

                                <r:RibbonControlGroup Margin="5,5,0,0">
                                    <r:RibbonButton Name="m_rbbtDecrease" 
                                                    Command="{StaticResource DecreaseCommand}"/>
                                    <r:RibbonButton Name="m_rbbtIncrease" 
                                                    Command="{StaticResource IncreaseCommand}"/>
                                </r:RibbonControlGroup>
                            </local:RibbonStackPanel >

                            <local:RibbonStackPanel Orientation="Horizontal"  
                                                    Margin="0,5,0,0">
                                <r:RibbonControlGroup Margin="0,5,0,0" >
                                    <r:RibbonToggleButton Name="m_rbtbLeft" 
                                                          Command="{StaticResource LeftCommand}"/>
                                    <r:RibbonToggleButton Name="m_rbtbRight" 
                                                          Command="{StaticResource RightCommand}"/>
                                    <r:RibbonToggleButton Name="m_rbtbCenter" 
                                                          Command="{StaticResource CenterCommand}"/>
                                    <r:RibbonToggleButton Name="m_rbtbJustify" 
                                                          Command="{StaticResource JustifyCommand}"/>
                                </r:RibbonControlGroup>

                            </local:RibbonStackPanel >
                        </r:RibbonGroup>
                        <!-- Paragraph Group -->

                        <!-- Insert Group -->
                        <r:RibbonGroup GroupSizeDefinitions="{StaticResource RibbonLayoutInsert}" >
                            <r:RibbonGroup.Command>
                                <r:RibbonCommand LabelTitle="Insert"/>
                            </r:RibbonGroup.Command>

                            <r:RibbonButton Name="m_rbbtInsertPicture" 
                                            Command="{StaticResource InsertPictureCommand}" 
                                            Height="Auto"/>
                            <r:RibbonButton Name="m_rbbtInsertHyperlink" 
                                            Command="{StaticResource InsertHyperlinkCommand}" 
                                            Height="Auto"/>
                            <r:RibbonButton Name="m_rbbtInsertLine" 
                                            Command="{StaticResource InsertLineCommand}" 
                                            Height="Auto"/>

                            <!--r:RibbonDropDownButton  Name="m_rbInsertActiveText"   
                            Command="{StaticResource InsertActiveTextCommand}"/-->
                            <local:RibbonBorder BorderThickness="1,1,1,1" 
                                                CornerRadius="10,10,10,10" 
                                                Margin="2,2,2,2">
                            <local:RibbonStackPanel Margin="2,2,2,5" >
                                <r:RibbonLabel  Content="Client data" 
                                                VerticalAlignment="Center" 
                                                HorizontalAlignment="Center" 
                                                ToolTip="Load client data"/>
                                <r:RibbonControlGroup>
                                    <r:RibbonComboBox Name="m_rbInsertActiveText" 
                                                      ToolTip="Vložit klientská data" 
                                                      Width="150" 
                                                      IsEditable="True" 
                                                      SelectedValuePath="Content" 
                                                      SelectionChanged="OnInsertActiveTextSelectionChanged" />
                                    <r:RibbonButton Name="m_rbbtInsertActiveTextButt" 
                                                    Command="{StaticResource InsertActiveTextCommand}" 
                                                    Height="Auto"/>
                                </r:RibbonControlGroup>
                            </local:RibbonStackPanel>
                            </local:RibbonBorder>
                        </r:RibbonGroup>
                        <!-- Insert Group -->

                        <!-- Table Group -->
                        <r:RibbonGroup GroupSizeDefinitions="{StaticResource RibbonLayoutTable}" >
                            <r:RibbonGroup.Command>
                                <r:RibbonCommand LabelTitle="Table"/>
                            </r:RibbonGroup.Command>

                            <r:RibbonButton Name="m_rbbtInsertTable" 
                                            Command="{StaticResource InsertTableCommand}" 
                                            Height="Auto"/>

                            <r:RibbonButton Name="m_rbbtInsertRowDown" 
                                            Command="{StaticResource InsertRowDownCommand}"/>
                            <r:RibbonButton Name="m_rbbtInsertRowUp" 
                                            Command="{StaticResource InsertRowUpCommand}"/>
                            <r:RibbonButton Name="m_rbbtInsertColumnLeft" 
                                            Command="{StaticResource InsertColumnLeftCommand}"/>
                            <r:RibbonButton Name="m_rbbtInsertColumnRight" 
                                            Command="{StaticResource InsertColumnRightCommand}"/>

                            <r:RibbonButton Name="m_rbbtDelRow" 
                                            Command="{StaticResource DelRowCommand}"/>
                            <r:RibbonButton Name="m_rbbtDelCol" 
                                            Command="{StaticResource DelColCommand}"/>

                            <r:RibbonButton Name="m_rbbtDelTable" 
                                            Command="{StaticResource DelTableCommand}"/>

                        </r:RibbonGroup>
                        <!-- Table Group -->

                    </r:RibbonTab.Groups>
                </r:RibbonTab>
                
                <!-- Main Tab -->

                <!-- Building Tabs starts here -->
            </r:Ribbon>
                    <!-- ################ RIBON END ################ -->


            <StatusBar DockPanel.Dock="Bottom" >
                <StatusBarItem>
                    <TextBlock x:Name="m_StatusBarLineInfo"/>
                </StatusBarItem>
                <StatusBarItem>
                    <Separator/>
                </StatusBarItem>
                <StatusBarItem>
                    <TextBlock x:Name="m_StatusBarMessage"/>
                </StatusBarItem>
            </StatusBar>
            <RichTextBox x:Name="m_RTB" 
                         DockPanel.Dock="Bottom" 
                         ContextMenu="{StaticResource RTEditorContextMenu}"
                         AcceptsTab="True" 
                         AcceptsReturn="True"
						 HorizontalScrollBarVisibility="Auto"
                         VerticalScrollBarVisibility="Visible"
						 SpellCheck.IsEnabled="True" 
                         Visibility="Visible">
                <RichTextBox.Resources>
                    <Style TargetType="{x:Type Paragraph}">
                        <Setter Property="Margin" Value="0"/>
                    </Style>
                </RichTextBox.Resources>
            </RichTextBox>
        </DockPanel>
    </Grid>
</UserControl>
